package com.ln.lnzw.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.ln.lnzw.R;
import com.ln.lnzw.activity.LoginActivity;
import com.ln.lnzw.base.BaseFragment;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by wuwei on 2018/4/24.
 * 热线电话
 */

public class ConsultingPhoneFragment extends BaseFragment {
    @BindView(R.id.wv_webview)
    WebView wvWebview;
    Unbinder unbinder;
    private String webUrl;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.consulting_phone_fragment_activity, null);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        webUrl =getArguments().getString("webUrl");
        Log.i("123", "onViewCreated: "+webUrl);
        wvWebview.getSettings().setSupportZoom(true);//支持缩放
        wvWebview.getSettings().setBuiltInZoomControls(true);
        wvWebview.getSettings().setUseWideViewPort(true);
        wvWebview.getSettings().setDisplayZoomControls(false);
        wvWebview.getSettings().setLoadWithOverviewMode(true);
        wvWebview.getSettings().setJavaScriptEnabled(true);
        wvWebview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        wvWebview.loadUrl(webUrl);
        wvWebview.setWebViewClient(new WebViewClient());
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
